package Twice.day05.homework1.dao.impl;

import Twice.day05.homework1.dao.IAccountDao;
import Twice.day05.homework1.entity.Account;

/**
 * @Author: lya
 * @Description: 本类的作用描述:
 * @CreateDate: 2019/8/27
 * @Version: 1.0
 */
public class AccountDaoImpl implements IAccountDao {
    @Override
    public void depoist(Account acc, double money) {
        if(money < 0){
            System.out.println("sorry,请输入有效金额!");
            return;
        }
        double d = acc.getAccBlance() + money;
        acc.setAccBlance(d);
    }

    @Override
    public void withdraw(Account acc, double money) {
        if (money > acc.getAccBlance()){
            System.out.println("余额不足");
            return;
        }
        acc.setAccBlance(acc.getAccBlance() - money);
    }
}
